package com.eorchis.module.trainingclass.job;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.context.ApplicationContext;

import com.eorchis.core.log4j.ILog4jManager;
import com.eorchis.module.schedule.BaseJob;
import com.eorchis.module.schedule.annotation.Job;
import com.eorchis.module.trainingclass.service.impl.TrainingClassServiceImpl;
import com.eorchis.module.trainingclass.ui.commond.TrainingClassQueryCommond;

/**
 * 根据当前时间更新班级的开班及报名状态
 * Title: UpdateOpenAndSignUpState<br>
 * Description: <br>
 * Copyright @ 2011~2016 Goldgov .All rights reserved.<br>
 * 
 * @author LongJZ
 * @createDate 2016-1-12
 * @version $Revision: $
 */
@Job(value = "updateOpenAndSignUpState")
public class UpdateOpenAndSignUpState extends BaseJob {

	@Override
	protected void executeJob(JobExecutionContext arg0, ApplicationContext arg1) throws JobExecutionException {
		TrainingClassServiceImpl trainingClassService = (TrainingClassServiceImpl) arg1.getBean("com.eorchis.module.trainingclass.service.impl.TrainingClassServiceImpl");
		// 记录日志
		ILog4jManager log4jManager = (ILog4jManager) arg1.getBean("com.eorchis.core.log4j.impl.Log4jManager");
		log4jManager.debugCustomLog("com.eorchis.module.trainingclass.job.UpdateOpenAndSignUpState", "execute", "更新班级的开班及报名状态");
		try {
			TrainingClassQueryCommond commond = new TrainingClassQueryCommond();
			trainingClassService.updateOpenAndSignUpState(commond);
		} catch (Exception e) {
			e.printStackTrace();
		}
		log4jManager.debugCustomLog("com.eorchis.module.trainingclass.job.UpdateOpenAndSignUpState", "execute", "更新班级的开班及报名状态");
	}

}
